﻿using System.Collections.Generic;

namespace Gma.CodeCloud.Base.TextAnalyses.Extractors.Code
{
    public class VbExtractor : CodeExtractorBase
    {
        private const string s_VbSinglelineCommentPrefix = "'";

        public VbExtractor(string file) 
            : base(file)
        {
        }

        protected override string SinglelineCommentPrefix
        {
            get { return s_VbSinglelineCommentPrefix; }
        }

        protected override bool CanSkipFile(string line)
        {
            return
                line.Contains("[TestFixture]") ||
                line.Contains("Used version of") ||
                line.Contains("Windows Form Designer generated code") ||
                line.Contains("This code was generated by a tool.");
        }


        protected override string IgnoreRegionsAndUsings(string text)
        {
            if (text.StartsWith("Imports")) return string.Empty;
            if (text.StartsWith("Namespace")) return string.Empty;
            if (text.StartsWith("#") & (text.Contains("region") || text.Contains("endregion"))) return string.Empty;
            return text;
        }
    }
}
